# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=assimp

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.0.1270
pkgrel=1
pkgdesc="Portable Open Source library to import various well-known 3D model formats in an uniform manner (mingw-w64)"
arch=('any')
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-boost" "${MINGW_PACKAGE_PREFIX}-crt" "${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" "${MINGW_PACKAGE_PREFIX}-gcc" 'unzip')
url=('http://assimp.sourceforge.net/index.html')
source=("http://downloads.sourceforge.net/project/assimp/assimp-3.0/assimp--${pkgver}-source-only.zip")
options=(!strip !buildflags staticlibs)
sha1sums=('e80a3a4326b649ed6585c0ce312ed6dd68942834')

build() {
  mkdir -p ${pkgdir}${MINGW_PREFIX}
  pushd ${pkgdir}${MINGW_PREFIX} > /dev/null
  export PREFIX_WIN=`pwd -W`
  popd > /dev/null
  
  pushd ${MINGW_PREFIX} > /dev/null
  export PREFIX_DEPS=`pwd -W`
  popd > /dev/null

    cd "${srcdir}/${_realname}--${pkgver}-source-only"
    ${MINGW_PREFIX}/bin/cmake.exe \
    -G"MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX:PATH=${PREFIX_WIN} \
    -DBUILD_ASSIMP_TOOLS=NO \
    -DBUILD_STATIC_LIB=ON \
    -DCMAKE_BUILD_TYPE=RELEASE
    make
}

package() {
    cd "${srcdir}/${_realname}--${pkgver}-source-only"
    make -j1 install #DESTDIR="$pkgdir"
  install -Dm644 "${srcdir}/${_realname}--${pkgver}-source-only/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${pkgname}/LICENSE"
}
